import pandas as pd
import matplotlib.pyplot as plt
import os
os.getcwd()
'C:\\Users\\bahad\\GitHub\\IE48B-Project\\Bahadır\\Final Notebooks'
data_path="D:/Datasets/IE48B_project/sample_data_files/"
initial_data="First_Data.csv"
# data=pd.read_csv(f"{data_path}{initial_data}")
data=pd.read_csv("bulk_imbalance.csv")
data.head()
| date | hour | net | upRegulationZeroCoded | upRegulationOneCoded | upRegulationTwoCoded | downRegulationZeroCoded | downRegulationOneCoded | downRegulationTwoCoded | upRegulationDelivered | downRegulationDelivered | system_direction | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2019-01-01 | 0 | -1934.795 | 0.0 | 0.0 | 0 | 2288.567 | 0.0 | 0 | 0.0 | -1934.795 | Negative |
| 1 | 2019-01-01 | 1 | -750.866 | 0.0 | 0.0 | 0 | 808.083 | 0.0 | 0 | 0.0 | -750.866 | Negative |
| 2 | 2019-01-01 | 2 | -982.767 | 0.0 | 0.0 | 0 | 1060.750 | 0.0 | 0 | 0.0 | -982.767 | Negative |
| 3 | 2019-01-01 | 3 | -764.620 | 0.0 | 0.0 | 0 | 1120.483 | 0.0 | 0 | 0.0 | -764.620 | Negative |
| 4 | 2019-01-01 | 4 | -1233.289 | 0.0 | 0.0 | 0 | 1874.633 | 56.0 | 0 | 0.0 | -1233.289 | Negative |
data.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 26832 entries, 0 to 26831 Data columns (total 12 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 date 26832 non-null object 1 hour 26832 non-null int64 2 net 26832 non-null float64 3 upRegulationZeroCoded 26832 non-null float64 4 upRegulationOneCoded 26832 non-null float64 5 upRegulationTwoCoded 26832 non-null int64 6 downRegulationZeroCoded 26832 non-null float64 7 downRegulationOneCoded 26832 non-null float64 8 downRegulationTwoCoded 26832 non-null int64 9 upRegulationDelivered 26832 non-null float64 10 downRegulationDelivered 26832 non-null float64 11 system_direction 26808 non-null object dtypes: float64(7), int64(3), object(2) memory usage: 2.5+ MB
import pandas_profiling
profile = pandas_profiling.profile_report.ProfileReport(data, explorative=True)
profile
data.columns
Index(['date', 'hour', 'net', 'upRegulationZeroCoded', 'upRegulationOneCoded',
'upRegulationTwoCoded', 'downRegulationZeroCoded',
'downRegulationOneCoded', 'downRegulationTwoCoded',
'upRegulationDelivered', 'downRegulationDelivered', 'system_direction'],
dtype='object')
corr_df=data.corr()
corr_df
| hour | net | upRegulationZeroCoded | upRegulationOneCoded | upRegulationTwoCoded | downRegulationZeroCoded | downRegulationOneCoded | downRegulationTwoCoded | upRegulationDelivered | downRegulationDelivered | |
|---|---|---|---|---|---|---|---|---|---|---|
| hour | 1.000000 | 0.129853 | 0.128186 | 0.058422 | NaN | 0.022954 | -0.020184 | NaN | 0.151178 | -0.012063 |
| net | 0.129853 | 1.000000 | 0.858280 | 0.030921 | NaN | -0.487597 | -0.085473 | NaN | 0.778473 | 0.454523 |
| upRegulationZeroCoded | 0.128186 | 0.858280 | 1.000000 | -0.109718 | NaN | -0.313936 | 0.091839 | NaN | 0.784907 | 0.224415 |
| upRegulationOneCoded | 0.058422 | 0.030921 | -0.109718 | 1.000000 | NaN | 0.597224 | 0.335422 | NaN | 0.489086 | -0.645846 |
| upRegulationTwoCoded | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| downRegulationZeroCoded | 0.022954 | -0.487597 | -0.313936 | 0.597224 | NaN | 1.000000 | 0.142681 | NaN | 0.099917 | -0.902077 |
| downRegulationOneCoded | -0.020184 | -0.085473 | 0.091839 | 0.335422 | NaN | 0.142681 | 1.000000 | NaN | 0.283038 | -0.534933 |
| downRegulationTwoCoded | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| upRegulationDelivered | 0.151178 | 0.778473 | 0.784907 | 0.489086 | NaN | 0.099917 | 0.283038 | NaN | 1.000000 | -0.205261 |
| downRegulationDelivered | -0.012063 | 0.454523 | 0.224415 | -0.645846 | NaN | -0.902077 | -0.534933 | NaN | -0.205261 | 1.000000 |
corr_df[["net"]].sort_values("net")
| net | |
|---|---|
| downRegulationZeroCoded | -0.487597 |
| downRegulationOneCoded | -0.085473 |
| upRegulationOneCoded | 0.030921 |
| hour | 0.129853 |
| downRegulationDelivered | 0.454523 |
| upRegulationDelivered | 0.778473 |
| upRegulationZeroCoded | 0.858280 |
| net | 1.000000 |
| upRegulationTwoCoded | NaN |
| downRegulationTwoCoded | NaN |
yal_one aslinda buradaki en kritik değer olarak kabul edilebilir çünkü o belirleyici bir rol oynuyor diğerlerine nazaran.
plt.plot(data["net"])
plt.show()
import numpy as np
data.head()
| date | hour | net | upRegulationZeroCoded | upRegulationOneCoded | upRegulationTwoCoded | downRegulationZeroCoded | downRegulationOneCoded | downRegulationTwoCoded | upRegulationDelivered | downRegulationDelivered | system_direction | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2019-01-01 | 0 | -1934.795 | 0.0 | 0.0 | 0 | 2288.567 | 0.0 | 0 | 0.0 | -1934.795 | Negative |
| 1 | 2019-01-01 | 1 | -750.866 | 0.0 | 0.0 | 0 | 808.083 | 0.0 | 0 | 0.0 | -750.866 | Negative |
| 2 | 2019-01-01 | 2 | -982.767 | 0.0 | 0.0 | 0 | 1060.750 | 0.0 | 0 | 0.0 | -982.767 | Negative |
| 3 | 2019-01-01 | 3 | -764.620 | 0.0 | 0.0 | 0 | 1120.483 | 0.0 | 0 | 0.0 | -764.620 | Negative |
| 4 | 2019-01-01 | 4 | -1233.289 | 0.0 | 0.0 | 0 | 1874.633 | 56.0 | 0 | 0.0 | -1233.289 | Negative |
data_req_hour=data[(data["hour"]<=23) & (data["hour"]>=12)]
data_daily=data_req_hour.loc[:, (data_req_hour.columns!="hour") ].groupby(["date"]).agg("sum")
data_daily
| net | upRegulationZeroCoded | upRegulationOneCoded | upRegulationTwoCoded | downRegulationZeroCoded | downRegulationOneCoded | downRegulationTwoCoded | upRegulationDelivered | downRegulationDelivered | |
|---|---|---|---|---|---|---|---|---|---|
| date | |||||||||
| 2019-01-01 | -4936.504 | 2263.768 | 0.000 | 0 | 6998.035 | 0.000 | 0 | 1269.321 | -6205.825 |
| 2019-01-02 | -7209.304 | 245.833 | 0.000 | 0 | 8863.785 | 0.000 | 0 | 245.833 | -7455.137 |
| 2019-01-03 | -8611.582 | 250.166 | 0.000 | 0 | 10972.534 | 0.000 | 0 | 249.496 | -8861.078 |
| 2019-01-04 | -18194.470 | 640.168 | 0.000 | 0 | 22524.867 | 0.000 | 0 | 640.168 | -18834.638 |
| 2019-01-05 | -7281.792 | 183.366 | 0.000 | 0 | 11868.664 | 0.000 | 0 | 181.196 | -7462.988 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2022-01-18 | 14661.584 | 17118.337 | 0.000 | 0 | 660.050 | 792.584 | 0 | 16033.705 | -1372.121 |
| 2022-01-19 | 11689.701 | 14880.947 | 6.667 | 0 | 394.900 | 0.000 | 0 | 12083.301 | -393.600 |
| 2022-01-20 | 17289.558 | 19882.518 | 0.000 | 0 | 542.800 | 0.000 | 0 | 17828.009 | -538.451 |
| 2022-01-21 | 45049.388 | 49622.803 | 0.000 | 0 | 78.000 | 1884.866 | 0 | 47011.284 | -1961.896 |
| 2022-01-22 | 0.000 | 0.000 | 0.000 | 0 | 0.000 | 0.000 | 0 | 0.000 | 0.000 |
1118 rows × 9 columns
from datetime import datetime, timedelta
data_daily["event"]=""
events={"2019-01-01":"Yeni Yil Tatili",
"2019-04-23":"Ulusal Egemenlik ve cocuk Bayrami",
"2019-05-01":"Emek ve Dayanisma Gunu",
"2019-05-19":"Ataturk’u Anma Genclik ve Spor Bayrami",
"2019-06-03":"Ramazan Bayrami Arifesi",
"2019-06-04":"Ramazan Bayrami",
"2019-06-05":"Ramazan Bayrami",
"2019-06-06":"Ramazan Bayrami",
"2019-07-15":"Demokrasi ve Milli Birlik Gunu",
"2019-08-10":"Kurban Bayrami Arifesi",
"2019-08-11":"Kurban Bayrami",
"2019-08-12":"Kurban Bayrami",
"2019-08-13":"Kurban Bayrami",
"2019-08-14":"Kurban Bayrami",
"2019-08-30":"Zafer Bayrami",
"2019-10-28":"Cumhuriyet Bayrami",
"2019-10-29":"Cumhuriyet Bayrami",
"2020-01-01":"Yeni Yil Tatili",
"2020-04-23":"Ulusal Egemenlik ve cocuk Bayrami",
"2020-05-01":"Emek ve Dayanisma Gunu",
"2020-05-19":"Ataturk’u Anma Genclik ve Spor Bayrami",
"2020-05-23":"Ramazan Bayrami Arifesi",
"2020-05-24":"Ramazan Bayrami",
"2020-05-25":"Ramazan Bayrami",
"2020-05-26":"Ramazan Bayrami",
"2020-07-15":"Demokrasi ve Milli Birlik Gunu",
"2020-07-30":"Kurban Bayrami Arifesi",
"2020-07-31":"Kurban Bayrami",
"2020-08-01":"Kurban Bayrami",
"2020-08-02":"Kurban Bayrami",
"2020-08-03":"Kurban Bayrami",
"2020-08-30":"Zafer Bayrami",
"2020-10-28":"Cumhuriyet Bayrami",
"2020-10-29":"Cumhuriyet Bayrami",
"2021-01-01":"Yeni Yil Tatili",
"2021-04-23":"Ulusal Egemenlik ve cocuk Bayrami",
"2021-05-01":"Emek ve Dayanisma Gunu",
"2021-05-12":"Ataturk’u Anma Genclik ve Spor Bayrami",
"2021-05-13":"Ramazan Bayrami Arifesi",
"2021-05-14":"Ramazan Bayrami",
"2021-05-15":"Ramazan Bayrami",
"2021-05-19":"Ramazan Bayrami",
"2021-07-15":"Demokrasi ve Milli Birlik Gunu",
"2021-07-19":"Kurban Bayrami Arifesi",
"2021-07-20":"Kurban Bayrami",
"2021-07-21":"Kurban Bayrami",
"2021-07-22":"Kurban Bayrami",
"2021-07-23":"Kurban Bayrami",
"2021-08-30":"Zafer Bayrami",
"2021-10-28":"Cumhuriyet Bayrami",
"2021-10-29":"Cumhuriyet Bayrami"}
for key, value in events.items():
if key in data_daily.index:
data_daily.at[key, "event"]= value
data_daily
| net | upRegulationZeroCoded | upRegulationOneCoded | upRegulationTwoCoded | downRegulationZeroCoded | downRegulationOneCoded | downRegulationTwoCoded | upRegulationDelivered | downRegulationDelivered | event | |
|---|---|---|---|---|---|---|---|---|---|---|
| date | ||||||||||
| 2019-01-01 | -4936.504 | 2263.768 | 0.000 | 0 | 6998.035 | 0.000 | 0 | 1269.321 | -6205.825 | Yeni Yil Tatili |
| 2019-01-02 | -7209.304 | 245.833 | 0.000 | 0 | 8863.785 | 0.000 | 0 | 245.833 | -7455.137 | |
| 2019-01-03 | -8611.582 | 250.166 | 0.000 | 0 | 10972.534 | 0.000 | 0 | 249.496 | -8861.078 | |
| 2019-01-04 | -18194.470 | 640.168 | 0.000 | 0 | 22524.867 | 0.000 | 0 | 640.168 | -18834.638 | |
| 2019-01-05 | -7281.792 | 183.366 | 0.000 | 0 | 11868.664 | 0.000 | 0 | 181.196 | -7462.988 | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2022-01-18 | 14661.584 | 17118.337 | 0.000 | 0 | 660.050 | 792.584 | 0 | 16033.705 | -1372.121 | |
| 2022-01-19 | 11689.701 | 14880.947 | 6.667 | 0 | 394.900 | 0.000 | 0 | 12083.301 | -393.600 | |
| 2022-01-20 | 17289.558 | 19882.518 | 0.000 | 0 | 542.800 | 0.000 | 0 | 17828.009 | -538.451 | |
| 2022-01-21 | 45049.388 | 49622.803 | 0.000 | 0 | 78.000 | 1884.866 | 0 | 47011.284 | -1961.896 | |
| 2022-01-22 | 0.000 | 0.000 | 0.000 | 0 | 0.000 | 0.000 | 0 | 0.000 | 0.000 |
1118 rows × 10 columns
data_daily.to_csv(data_path+"data_daily_event.csv")
upper_limit=np.quantile(data_daily["net"], 0.95)
lower_limit=np.quantile(data_daily["net"], 0.05)
upper_limit
25879.68019999997
lower_limit
-10908.2216
ext_data=data_daily[(data_daily["net"]>=upper_limit) | (data_daily["net"]<=lower_limit)]
ext_data.head()
| net | upRegulationZeroCoded | upRegulationOneCoded | upRegulationTwoCoded | downRegulationZeroCoded | downRegulationOneCoded | downRegulationTwoCoded | upRegulationDelivered | downRegulationDelivered | event | |
|---|---|---|---|---|---|---|---|---|---|---|
| date | ||||||||||
| 2019-01-04 | -18194.470 | 640.168 | 0.0 | 0 | 22524.867 | 0.0 | 0 | 640.168 | -18834.638 | |
| 2019-01-17 | -11177.479 | 2019.600 | 0.0 | 0 | 11483.884 | 3804.1 | 0 | 1105.663 | -12283.142 | |
| 2019-01-20 | -16111.589 | 0.000 | 0.0 | 0 | 22983.999 | 0.0 | 0 | 0.000 | -16111.589 | |
| 2019-01-28 | -18648.800 | 0.000 | 0.0 | 0 | 23447.567 | 0.0 | 0 | 0.000 | -18648.800 | |
| 2019-03-09 | -15677.235 | 41.667 | 0.0 | 0 | 16874.650 | 0.0 | 0 | 41.667 | -15718.902 |
ext_data.info()
<class 'pandas.core.frame.DataFrame'> Index: 112 entries, 2019-01-04 to 2022-01-21 Data columns (total 10 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 net 112 non-null float64 1 upRegulationZeroCoded 112 non-null float64 2 upRegulationOneCoded 112 non-null float64 3 upRegulationTwoCoded 112 non-null int64 4 downRegulationZeroCoded 112 non-null float64 5 downRegulationOneCoded 112 non-null float64 6 downRegulationTwoCoded 112 non-null int64 7 upRegulationDelivered 112 non-null float64 8 downRegulationDelivered 112 non-null float64 9 event 112 non-null object dtypes: float64(7), int64(2), object(1) memory usage: 9.6+ KB
important_dates_2=[]
important_dates_3=[]
important_dates_4=[]
for i in range(ext_data.shape[0]-1):
current_date=datetime.strptime(ext_data.index[i], '%Y-%m-%d')
next_day=current_date + timedelta(days=1)
two_day=current_date + timedelta(days=2)
three_day=current_date + timedelta(days=3)
if datetime.strptime(ext_data.index[i+1], '%Y-%m-%d')==next_day:
important_dates_2.append(ext_data.index[i])
if i < ext_data.shape[0]-2:
if datetime.strptime(ext_data.index[i+2], '%Y-%m-%d')==two_day:
important_dates_3.append(ext_data.index[i])
if i < ext_data.shape[0]-3:
if datetime.strptime(ext_data.index[i+3], '%Y-%m-%d')==three_day:
important_dates_4.append(ext_data.index[i])
important_dates_2
['2019-03-09', '2019-06-04', '2019-06-28', '2019-06-29', '2019-06-30', '2019-07-13', '2020-02-25', '2020-04-06', '2020-05-22', '2020-05-23', '2020-05-24', '2020-07-02', '2020-07-08', '2020-09-01', '2020-09-02', '2020-09-23', '2020-10-06', '2020-12-28', '2020-12-29', '2021-02-03', '2021-03-09', '2021-06-25', '2021-06-28', '2021-06-29', '2021-06-30', '2021-07-01', '2021-07-29', '2021-07-30', '2021-08-02', '2021-08-03', '2021-08-04', '2021-08-05', '2021-08-17', '2021-08-25', '2021-08-26', '2021-09-02', '2021-12-16', '2021-12-20', '2021-12-21', '2021-12-22']
important_dates_3
['2019-06-28', '2019-06-29', '2020-05-22', '2020-05-23', '2020-09-01', '2020-12-28', '2021-06-28', '2021-06-29', '2021-06-30', '2021-07-29', '2021-08-02', '2021-08-03', '2021-08-04', '2021-08-25', '2021-12-20', '2021-12-21']
important_dates_4
['2019-06-28', '2020-05-22', '2021-06-28', '2021-06-29', '2021-08-02', '2021-08-03', '2021-12-20']
events_df=pd.DataFrame.from_dict(events,orient='index')
events_df.reset_index(level=0, inplace=True)
events_df[events_df.isin(important_dates_2).loc[:,"index"]]
| index | 0 | |
|---|---|---|
| 5 | 2019-06-04 | Ramazan Bayrami |
| 21 | 2020-05-23 | Ramazan Bayrami Arifesi |
| 22 | 2020-05-24 | Ramazan Bayrami |
events_df[events_df.isin(important_dates_3).loc[:,"index"]]
| index | 0 | |
|---|---|---|
| 21 | 2020-05-23 | Ramazan Bayrami Arifesi |
events_df[events_df.isin(important_dates_4).loc[:,"index"]]
| index | 0 |
|---|
pot_ext_df=ext_data[ext_data["net"]>0]
pot_ext_df
| net | upRegulationZeroCoded | upRegulationOneCoded | upRegulationTwoCoded | downRegulationZeroCoded | downRegulationOneCoded | downRegulationTwoCoded | upRegulationDelivered | downRegulationDelivered | event | |
|---|---|---|---|---|---|---|---|---|---|---|
| date | ||||||||||
| 2019-04-01 | 26128.507 | 42644.981 | 0.000 | 0 | 8.750 | 202.166 | 0 | 26336.823 | -208.316 | |
| 2019-06-25 | 33982.908 | 27415.301 | 13794.966 | 0 | 58.750 | 411.499 | 0 | 34450.257 | -467.349 | |
| 2019-07-03 | 36038.056 | 38028.536 | 6571.949 | 0 | 178.300 | 85.000 | 0 | 36297.356 | -259.300 | |
| 2019-08-26 | 29454.199 | 36994.367 | 0.000 | 0 | 1010.918 | 0.000 | 0 | 30461.560 | -1007.361 | |
| 2020-01-06 | 27446.566 | 31927.648 | 0.000 | 0 | 366.633 | 0.000 | 0 | 27805.199 | -358.633 | |
| 2020-02-08 | 28520.773 | 32913.202 | 0.000 | 0 | 106.234 | 0.000 | 0 | 28626.617 | -105.844 | |
| 2020-07-02 | 31774.933 | 32620.583 | 4247.000 | 0 | 365.351 | 0.000 | 0 | 32136.536 | -361.603 | |
| 2020-07-03 | 30559.055 | 36734.030 | 0.000 | 0 | 554.750 | 0.000 | 0 | 31105.805 | -546.750 | |
| 2020-07-26 | 27526.311 | 32186.023 | 0.000 | 0 | 230.283 | 0.000 | 0 | 27750.494 | -224.183 | |
| 2020-08-25 | 27153.286 | 29637.982 | 1488.334 | 0 | 166.168 | 0.000 | 0 | 27314.454 | -161.168 | |
| 2020-09-01 | 29417.435 | 32877.899 | 0.000 | 0 | 271.917 | 0.000 | 0 | 29686.852 | -269.417 | |
| 2020-09-02 | 32323.309 | 36990.890 | 0.000 | 0 | 0.000 | 0.000 | 0 | 32323.309 | 0.000 | |
| 2020-09-03 | 46716.710 | 54411.097 | 0.000 | 0 | 9.583 | 0.000 | 0 | 46726.293 | -9.583 | |
| 2020-09-23 | 37312.015 | 40032.517 | 0.000 | 0 | 301.617 | 0.000 | 0 | 37612.632 | -300.617 | |
| 2020-09-24 | 33095.948 | 36092.564 | 0.000 | 0 | 440.400 | 0.000 | 0 | 33522.348 | -426.400 | |
| 2020-10-06 | 26919.594 | 31551.366 | 0.000 | 0 | 176.000 | 0.000 | 0 | 27095.594 | -176.000 | |
| 2020-10-07 | 26054.702 | 29495.500 | 0.000 | 0 | 368.167 | 0.000 | 0 | 26422.869 | -368.167 | |
| 2021-01-18 | 30229.607 | 35931.367 | 0.000 | 0 | 712.950 | 0.000 | 0 | 30922.477 | -692.870 | |
| 2021-03-09 | 30288.200 | 32755.419 | 0.000 | 0 | 462.917 | 0.000 | 0 | 30734.931 | -446.731 | |
| 2021-03-10 | 30650.873 | 34325.486 | 0.000 | 0 | 609.718 | 0.000 | 0 | 31204.291 | -553.418 | |
| 2021-03-18 | 39716.380 | 45148.450 | 0.000 | 0 | 202.517 | 0.000 | 0 | 39918.897 | -202.517 | |
| 2021-04-10 | 31398.748 | 34384.299 | 0.000 | 0 | 20.600 | 0.000 | 0 | 31419.348 | -20.600 | |
| 2021-04-12 | 32025.933 | 34190.831 | 0.000 | 0 | 50.166 | 0.000 | 0 | 32075.809 | -49.876 | |
| 2021-06-25 | 33548.800 | 37234.049 | 0.000 | 0 | 76.417 | 0.000 | 0 | 33623.617 | -74.817 | |
| 2021-06-26 | 26947.574 | 30228.552 | 0.000 | 0 | 0.000 | 0.000 | 0 | 26947.574 | 0.000 | |
| 2021-06-28 | 30165.554 | 34811.817 | 0.000 | 0 | 80.250 | 0.000 | 0 | 30245.455 | -79.901 | |
| 2021-06-29 | 29969.097 | 33978.730 | 0.000 | 0 | 36.683 | 0.000 | 0 | 30005.780 | -36.683 | |
| 2021-06-30 | 64511.929 | 76338.880 | 0.000 | 0 | 0.000 | 0.000 | 0 | 64511.929 | 0.000 | |
| 2021-07-01 | 67107.201 | 78314.017 | 0.000 | 0 | 135.134 | 0.000 | 0 | 67235.960 | -128.759 | |
| 2021-07-02 | 43650.542 | 55152.536 | 0.000 | 0 | 218.150 | 0.000 | 0 | 43861.826 | -211.284 | |
| 2021-07-05 | 40549.047 | 42366.317 | 0.000 | 0 | 132.000 | 0.000 | 0 | 40680.707 | -131.660 | |
| 2021-07-17 | 31777.250 | 34993.433 | 0.000 | 0 | 165.867 | 492.501 | 0 | 32421.851 | -644.601 | |
| 2021-07-26 | 26104.220 | 30056.853 | 0.000 | 0 | 74.250 | 737.333 | 0 | 26852.491 | -748.271 | |
| 2021-07-29 | 37582.477 | 42197.816 | 0.000 | 0 | 44.500 | 1291.416 | 0 | 38879.799 | -1297.322 | |
| 2021-07-30 | 58284.962 | 62084.884 | 0.000 | 0 | 0.000 | 0.000 | 0 | 58284.962 | 0.000 | |
| 2021-07-31 | 47654.423 | 53262.080 | 0.000 | 0 | 0.000 | 0.000 | 0 | 47654.423 | 0.000 | |
| 2021-08-02 | 77832.166 | 82285.964 | 0.000 | 0 | 0.000 | 0.000 | 0 | 77832.166 | 0.000 | |
| 2021-08-03 | 67857.957 | 76095.300 | 0.000 | 0 | 0.000 | 3741.835 | 0 | 71522.224 | -3664.267 | |
| 2021-08-04 | 86280.360 | 92640.183 | 0.000 | 0 | 0.000 | 2558.167 | 0 | 88654.527 | -2374.167 | |
| 2021-08-05 | 98095.948 | 104229.267 | 0.000 | 0 | 0.000 | 0.000 | 0 | 98095.948 | 0.000 | |
| 2021-08-06 | 93203.126 | 99691.003 | 0.000 | 0 | 0.000 | 0.000 | 0 | 93203.126 | 0.000 | |
| 2021-08-11 | 32930.799 | 36340.217 | 0.000 | 0 | 120.633 | 0.000 | 0 | 33050.402 | -119.603 | |
| 2021-08-17 | 35940.612 | 38628.617 | 0.000 | 0 | 154.100 | 0.000 | 0 | 36094.528 | -153.916 | |
| 2021-08-18 | 33035.630 | 35705.050 | 0.000 | 0 | 32.650 | 125.833 | 0 | 33194.113 | -158.483 | |
| 2021-08-25 | 40818.135 | 44299.684 | 0.000 | 0 | 158.800 | 0.000 | 0 | 40976.935 | -158.800 | |
| 2021-08-26 | 52292.960 | 55257.450 | 0.000 | 0 | 50.300 | 0.000 | 0 | 52342.760 | -49.800 | |
| 2021-08-27 | 48729.994 | 51967.067 | 0.000 | 0 | 77.250 | 0.000 | 0 | 48807.244 | -77.250 | |
| 2021-12-16 | 26057.704 | 26872.268 | 0.000 | 0 | 209.833 | 0.000 | 0 | 26265.178 | -207.474 | |
| 2021-12-17 | 35092.792 | 35790.166 | 0.000 | 0 | 54.000 | 0.000 | 0 | 35146.792 | -54.000 | |
| 2021-12-20 | 39545.354 | 41772.652 | 0.000 | 0 | 1726.433 | 0.000 | 0 | 41196.958 | -1651.604 | |
| 2021-12-21 | 31121.900 | 37505.784 | 0.000 | 0 | 6091.717 | 0.000 | 0 | 36982.110 | -5860.210 | |
| 2021-12-22 | 41354.631 | 55052.248 | 0.000 | 0 | 13877.350 | 0.000 | 0 | 54639.689 | -13285.058 | |
| 2021-12-23 | 30779.736 | 53607.549 | 0.000 | 0 | 23899.033 | 0.000 | 0 | 53242.438 | -22462.702 | |
| 2022-01-06 | 31947.725 | 33037.566 | 0.000 | 0 | 263.100 | 0.000 | 0 | 32210.825 | -263.100 | |
| 2022-01-11 | 37893.528 | 40566.717 | 0.000 | 0 | 572.617 | 58.500 | 0 | 38458.925 | -565.397 | |
| 2022-01-21 | 45049.388 | 49622.803 | 0.000 | 0 | 78.000 | 1884.866 | 0 | 47011.284 | -1961.896 |
pot_ext_df[pot_ext_df["event"]!=""]
| net | upRegulationZeroCoded | upRegulationOneCoded | upRegulationTwoCoded | downRegulationZeroCoded | downRegulationOneCoded | downRegulationTwoCoded | upRegulationDelivered | downRegulationDelivered | event | |
|---|---|---|---|---|---|---|---|---|---|---|
| date |
pot_ext_df.sort_values("net", ascending=False).iloc[1:10,:]
| net | upRegulationZeroCoded | upRegulationOneCoded | upRegulationTwoCoded | downRegulationZeroCoded | downRegulationOneCoded | downRegulationTwoCoded | upRegulationDelivered | downRegulationDelivered | event | |
|---|---|---|---|---|---|---|---|---|---|---|
| date | ||||||||||
| 2021-08-06 | 93203.126 | 99691.003 | 0.0 | 0 | 0.000 | 0.000 | 0 | 93203.126 | 0.000 | |
| 2021-08-04 | 86280.360 | 92640.183 | 0.0 | 0 | 0.000 | 2558.167 | 0 | 88654.527 | -2374.167 | |
| 2021-08-02 | 77832.166 | 82285.964 | 0.0 | 0 | 0.000 | 0.000 | 0 | 77832.166 | 0.000 | |
| 2021-08-03 | 67857.957 | 76095.300 | 0.0 | 0 | 0.000 | 3741.835 | 0 | 71522.224 | -3664.267 | |
| 2021-07-01 | 67107.201 | 78314.017 | 0.0 | 0 | 135.134 | 0.000 | 0 | 67235.960 | -128.759 | |
| 2021-06-30 | 64511.929 | 76338.880 | 0.0 | 0 | 0.000 | 0.000 | 0 | 64511.929 | 0.000 | |
| 2021-07-30 | 58284.962 | 62084.884 | 0.0 | 0 | 0.000 | 0.000 | 0 | 58284.962 | 0.000 | |
| 2021-08-26 | 52292.960 | 55257.450 | 0.0 | 0 | 50.300 | 0.000 | 0 | 52342.760 | -49.800 | |
| 2021-08-27 | 48729.994 | 51967.067 | 0.0 | 0 | 77.250 | 0.000 | 0 | 48807.244 | -77.250 |
neg_ext_df=ext_data[ext_data["net"]<0]
neg_ext_df
| net | upRegulationZeroCoded | upRegulationOneCoded | upRegulationTwoCoded | downRegulationZeroCoded | downRegulationOneCoded | downRegulationTwoCoded | upRegulationDelivered | downRegulationDelivered | event | |
|---|---|---|---|---|---|---|---|---|---|---|
| date | ||||||||||
| 2019-01-04 | -18194.470 | 640.168 | 0.000 | 0 | 22524.867 | 0.000 | 0 | 640.168 | -18834.638 | |
| 2019-01-17 | -11177.479 | 2019.600 | 0.000 | 0 | 11483.884 | 3804.100 | 0 | 1105.663 | -12283.142 | |
| 2019-01-20 | -16111.589 | 0.000 | 0.000 | 0 | 22983.999 | 0.000 | 0 | 0.000 | -16111.589 | |
| 2019-01-28 | -18648.800 | 0.000 | 0.000 | 0 | 23447.567 | 0.000 | 0 | 0.000 | -18648.800 | |
| 2019-03-09 | -15677.235 | 41.667 | 0.000 | 0 | 16874.650 | 0.000 | 0 | 41.667 | -15718.902 | |
| 2019-03-10 | -15280.100 | 54.166 | 0.000 | 0 | 16642.049 | 0.000 | 0 | 54.166 | -15334.266 | |
| 2019-04-14 | -16097.128 | 2299.367 | 8862.849 | 0 | 20990.015 | 8252.000 | 0 | 8487.568 | -24584.696 | |
| 2019-06-04 | -32237.438 | 4355.845 | 394.767 | 0 | 19405.067 | 17239.200 | 0 | 3739.045 | -35976.483 | Ramazan Bayrami |
| 2019-06-05 | -13244.768 | 13333.583 | 1464.299 | 0 | 12954.932 | 8062.534 | 0 | 6727.278 | -19972.046 | Ramazan Bayrami |
| 2019-06-28 | -11023.723 | 449.168 | 3746.383 | 0 | 18474.882 | 1038.834 | 0 | 4050.341 | -15074.064 | |
| 2019-06-29 | -24209.235 | 19.917 | 0.000 | 0 | 32338.868 | 12.500 | 0 | 19.450 | -24228.685 | |
| 2019-06-30 | -19920.178 | 40.250 | 0.000 | 0 | 23838.398 | 832.500 | 0 | 40.250 | -19960.428 | |
| 2019-07-01 | -29624.172 | 211.917 | 6325.667 | 0 | 43506.682 | 899.667 | 0 | 6435.164 | -36059.336 | |
| 2019-07-11 | -18192.803 | 154.666 | 0.000 | 0 | 19837.353 | 0.000 | 0 | 152.566 | -18345.369 | |
| 2019-07-13 | -11080.907 | 194.500 | 0.000 | 0 | 14105.615 | 0.000 | 0 | 190.500 | -11271.407 | |
| 2019-07-14 | -13547.695 | 63.100 | 0.000 | 0 | 15693.915 | 0.000 | 0 | 63.100 | -13610.795 | |
| 2019-08-05 | -13657.450 | 277.967 | 0.000 | 0 | 16823.797 | 0.000 | 0 | 269.767 | -13927.217 | |
| 2019-08-17 | -13047.887 | 99.417 | 0.000 | 0 | 17667.180 | 0.000 | 0 | 96.417 | -13144.304 | |
| 2019-09-08 | -13297.637 | 171.834 | 0.000 | 0 | 17754.567 | 0.000 | 0 | 171.834 | -13469.471 | |
| 2019-09-15 | -11670.190 | 279.133 | 0.000 | 0 | 13746.568 | 0.000 | 0 | 277.363 | -11947.553 | |
| 2019-09-21 | -24191.682 | 319.249 | 0.000 | 0 | 27802.098 | 0.000 | 0 | 319.249 | -24510.931 | |
| 2020-02-03 | -11101.520 | 197.666 | 0.000 | 0 | 14389.651 | 0.000 | 0 | 152.666 | -11254.186 | |
| 2020-02-25 | -13390.492 | 599.366 | 0.000 | 0 | 15660.713 | 0.000 | 0 | 594.026 | -13984.518 | |
| 2020-02-26 | -13299.576 | 572.001 | 0.000 | 0 | 11915.999 | 2781.333 | 0 | 547.001 | -13846.577 | |
| 2020-03-02 | -11940.048 | 147.666 | 96.667 | 0 | 14190.784 | 138.000 | 0 | 244.333 | -12184.381 | |
| 2020-03-11 | -11088.892 | 212.483 | 8628.899 | 0 | 23200.020 | 0.000 | 0 | 8726.422 | -19815.314 | |
| 2020-03-21 | -15240.067 | 688.183 | 1894.067 | 0 | 20789.849 | 114.000 | 0 | 2575.600 | -17815.667 | |
| 2020-03-23 | -16588.493 | 230.116 | 1365.700 | 0 | 20540.750 | 345.833 | 0 | 1592.626 | -18181.119 | |
| 2020-03-30 | -14291.782 | 168.083 | 8750.566 | 0 | 25305.619 | 83.500 | 0 | 8820.849 | -23112.631 | |
| 2020-04-06 | -14317.567 | 55.000 | 0.000 | 0 | 15978.062 | 0.000 | 0 | 47.000 | -14364.567 | |
| 2020-04-07 | -11043.764 | 0.000 | 2359.499 | 0 | 12547.152 | 1207.250 | 0 | 2121.239 | -13165.003 | |
| 2020-04-11 | -29725.309 | 18.333 | 0.000 | 0 | 21265.149 | 9807.283 | 0 | 18.333 | -29743.642 | |
| 2020-05-01 | -19906.628 | 177.599 | 0.000 | 0 | 22477.434 | 0.000 | 0 | 177.599 | -20084.227 | Emek ve Dayanisma Gunu |
| 2020-05-10 | -12752.545 | 74.467 | 0.000 | 0 | 13675.498 | 74.867 | 0 | 74.330 | -12826.875 | |
| 2020-05-22 | -20301.316 | 18.267 | 0.000 | 0 | 22570.666 | 0.000 | 0 | 18.267 | -20319.583 | |
| 2020-05-23 | -20928.733 | 50.834 | 0.000 | 0 | 21809.199 | 0.000 | 0 | 50.834 | -20979.567 | Ramazan Bayrami Arifesi |
| 2020-05-24 | -20373.771 | 415.467 | 0.000 | 0 | 21069.967 | 0.000 | 0 | 344.312 | -20718.083 | Ramazan Bayrami |
| 2020-05-25 | -17973.323 | 20.750 | 0.000 | 0 | 19189.115 | 0.000 | 0 | 18.833 | -17992.156 | Ramazan Bayrami |
| 2020-07-08 | -14421.001 | 213.116 | 0.000 | 0 | 16136.800 | 0.000 | 0 | 200.667 | -14621.668 | |
| 2020-07-09 | -19532.547 | 132.167 | 0.000 | 0 | 20789.518 | 0.000 | 0 | 132.167 | -19664.714 | |
| 2020-08-03 | -14282.613 | 162.000 | 0.000 | 0 | 13554.584 | 2174.167 | 0 | 149.066 | -14431.679 | Kurban Bayrami |
| 2020-11-18 | -17749.750 | 2259.225 | 0.000 | 0 | 8681.716 | 12097.266 | 0 | 2094.608 | -19844.358 | |
| 2020-12-28 | -12187.690 | 226.500 | 0.000 | 0 | 14680.501 | 0.000 | 0 | 221.500 | -12409.190 | |
| 2020-12-29 | -20493.418 | 685.082 | 0.000 | 0 | 24684.115 | 209.167 | 0 | 661.082 | -21154.500 | |
| 2020-12-30 | -13142.825 | 627.083 | 0.000 | 0 | 15373.581 | 0.000 | 0 | 616.583 | -13759.408 | |
| 2021-01-02 | -12841.856 | 282.384 | 0.000 | 0 | 14570.368 | 0.000 | 0 | 282.264 | -13124.120 | |
| 2021-01-23 | -12574.789 | 1072.917 | 0.000 | 0 | 14757.251 | 0.000 | 0 | 943.615 | -13518.404 | |
| 2021-02-03 | -12821.221 | 761.966 | 0.000 | 0 | 14773.318 | 1.800 | 0 | 715.966 | -13537.187 | |
| 2021-02-04 | -14440.116 | 545.917 | 0.000 | 0 | 17000.949 | 0.000 | 0 | 545.917 | -14986.033 | |
| 2021-04-07 | -13782.827 | 1533.349 | 0.000 | 0 | 15887.750 | 140.834 | 0 | 1296.401 | -15079.228 | |
| 2021-05-13 | -16562.912 | 505.635 | 0.000 | 0 | 17527.201 | 0.000 | 0 | 464.158 | -17027.070 | Ramazan Bayrami Arifesi |
| 2021-07-24 | -17230.998 | 1430.199 | 0.000 | 0 | 15487.568 | 3763.100 | 0 | 1154.849 | -18385.847 | |
| 2021-08-08 | -20723.291 | 0.000 | 0.000 | 0 | 22811.216 | 0.000 | 0 | 0.000 | -20723.291 | |
| 2021-09-02 | -22637.766 | 0.000 | 0.000 | 0 | 21539.583 | 2244.400 | 0 | 0.000 | -22637.766 | |
| 2021-09-03 | -16769.970 | 1087.900 | 0.000 | 0 | 18226.331 | 642.000 | 0 | 924.503 | -17694.473 | |
| 2021-09-23 | -12162.570 | 26.000 | 0.000 | 0 | 12733.132 | 0.000 | 0 | 25.051 | -12187.621 |
neg_ext_df[neg_ext_df["event"]!=""].iloc[:,[0,-1]]
| net | event | |
|---|---|---|
| date | ||
| 2019-06-04 | -32237.438 | Ramazan Bayrami |
| 2019-06-05 | -13244.768 | Ramazan Bayrami |
| 2020-05-01 | -19906.628 | Emek ve Dayanisma Gunu |
| 2020-05-23 | -20928.733 | Ramazan Bayrami Arifesi |
| 2020-05-24 | -20373.771 | Ramazan Bayrami |
| 2020-05-25 | -17973.323 | Ramazan Bayrami |
| 2020-08-03 | -14282.613 | Kurban Bayrami |
| 2021-05-13 | -16562.912 | Ramazan Bayrami Arifesi |